class Solution {
public:
    bool solve(string A, string B) {
        int n = A.size();
        A = A + A;
        int m = A.size();
        for (int i = 0; i < m; i++)
        {
            string t = A.substr(i, n);
            if (t == B) return true;
        }

        return false;
    }
};
